Comparing model outputs of fishery catch.
Code
# load ----
library(dplyr)
library(ggplot2)
library(plotly)
theme_set(theme_bw())
# data ----
catch = read.csv(here::here('data', 'admb', 'catch.csv')) %>%
rename(admb_2022 = pred) %>%
mutate(year = 1961:2022) %>%
left_join(data.frame(year = 1961:2022,
rtmb_2022 = readRDS(here::here('data', 'rtmb', 'report1.rds'))$catch_pred))
catch %>%
tidyr::pivot_longer(c(rtmb_2022, admb_2022), names_to='model') %>%
ggplot(aes(year, obs)) +
geom_point(color='gray') +
expand_limits(y=0) +
scale_y_continuous(labels = scales::comma) +
geom_line(aes(y = value, color = model)) +
scico::scale_color_scico_d(palette = 'roma') +
xlab('Year') +
ylab('Biomass (t)') -> p1
ggplotly(p1)%>%
layout(legend = list( x = 0.75, y = .75))
Code
catch %>%
mutate(diff = (admb_2022 - rtmb_2022) / admb_2022) %>%
ggplot(aes(year, diff)) +
geom_point() +
geom_hline(yintercept = 0, lty=3, alpha = 0.5) +
scale_y_continuous(labels = scales::percent) +
xlab('Year') +
ylab('Percent difference') -> p2
ggplotly(p2)